explorer.ConnectionDialog = function(){};
core.extendClass('explorer.ConnectionDialog', 'core.JSDialog');

explorer.ConnectionDialog.prototype.createDialog = function(aData){
    core.log('Creating connection dialog');
    var instance = this;
    var dlg = new core.Dialog({
        title: 'Connect to server:',
        maxWidth: 400,
        items:[
            core.createLabel('Name:'),
            new core.form.TextField({
                id: 'name'
            }),
            core.createLabel('Protocol:'),
            new core.form.ComboBox({
                id: 'protocol',
                options:[
                    {
                        id: 'sftp://',
                        name: 'SFTP share'
                    },{
                        id: 'smb://',
                        name: 'Windows share'
                    }
                ]
            }),
            core.createLabel('Address:'),
            new core.form.TextField({
                id: 'host'
            }),
            core.createLabel('Path:'),
            new core.form.TextField({
                id: 'path'
            }),
            core.createLabel('Username:'),
            new core.form.TextField({
                id: 'username'
            }),
            core.createLabel('Password:'),
            new core.form.TextField({
                id: 'password',
                password: true
            }),
//            core.createLabel(''),
//            new core.form.CheckBox({
//                id: 'save_pass',
//                text: 'Save password (encrypted)'
//            }),
//            core.createLabel(''),
//            new core.form.CheckBox({
//                id: 'auto_connect',
//                text: 'Automatically connect'
//            }),
            new core.Box({
                colspan: 2,
                items:[
                    new core.form.Button({
                        text: 'Save',
                        align: 'right',
                        handler: function(){
                            instance.send({
                                method: 'okClick',
                                message: dlg.body.getValue(),
                                disable: dlg
                            });
                        }
                    }),
                    new core.form.Button({
                        text: 'Cancel',
                        handler: function(){
                            instance.send({
                                method: 'cancelClick',
                                disable: dlg
                            });
                        }
                    })

                ], columns: '1, d'
            })
        ],
        rows: 'd, d, d, d, d, d, d',
        columns: '0.2, 0.8'
    });
    dlg.body.setValue(aData);
    return dlg;
};

explorer.FolderEditor = function(){};
core.extendClass('explorer.FolderEditor', 'core.JSDialog');

explorer.FolderEditor.prototype.createDialog = function(aData){
    var instance = this;
    var name = new core.form.TextField({
        id: 'name'
    });
    var dlg = new core.Dialog({
        title: 'Folder:',
        maxWidth: 400,
        items:[
            core.createLabel('Name:'),
            name,
            new core.Box({
                colspan: 2,
                items:[
                    new core.form.Button({
                        text: 'Save',
                        align: 'right',
                        handler: function(){
                            instance.send({
                                method: 'okClick',
                                message: dlg.body.getValue(),
                                disable: dlg
                            });
                        }
                    }),
                    new core.form.Button({
                        text: 'Cancel',
                        handler: function(){
                            instance.send({
                                method: 'cancelClick',
                                disable: dlg
                            });
                        }
                    })

                ], columns: '1, d'
            })
        ],
        rows: 'd, d',
        columns: '0.2, 0.8',
        defaultItem: name
    });
    dlg.body.setValue(aData);
    return dlg;
};
